import request from '../utils/http.js'
export default {
	// 只能用于存放公共常量
	data() {
		return {
			// uploadFileReqPath: 'http://localhost:10010/api/upload/iv',
			uploadFileReqPath: '/axh/upload/iv',
			// oss请求前缀
			ossReqPrefix: 'https://qsb-resource.oss-cn-shanghai.aliyuncs.com',
			// 顶部header样式
			navbarClass: {
				titleStyle: {
					fontWeight: "bold",
				},
				titleBgColor: '#fff'
			},
			// 禁止屏幕滚动
			isTouchMove: false,
		}
	},

	onLoad() {},
	methods: {
		uploadFilePromise(url) {
			let reqPath = request.apiUrl + this.uploadFileReqPath;
			return new Promise((resolve, reject) => {
				let a = uni.uploadFile({
					url: reqPath, // 仅为示例，非真实的接口地址
					filePath: url,
					formData: {
						phoneAuth: 1,
					},
					name: "file",
					header: {
						up_iv_account: "UPLOAD_IMAGE_VIDEO_VALUE",
					},
					success: (res) => {
						let updateRes = JSON.parse(res.data);
						if (updateRes.code !== 200) {
							uni.showToast({
								title: updateRes.msg,
								duration: 2000,
								icon: "none",
							});
							return;
						}
						uni.showToast({
							title: "上传成功",
							duration: 2000,
							icon: "none",
						});
						setTimeout(() => {
							resolve(updateRes);
						}, 1000);
					},
				});
			});
		},
	},
	onShow() {

	}
}